package principles.demo2;

/**
 * @description: 测试类
 **/

public class RectangleDemo {
    public static void main(String[] args) {
        //创建长方形对象
        Rectangele rectangele = new Rectangele();
        rectangele.setLength(20);
        rectangele.setWidth(10);
        //调用方法扩宽
        resize(rectangele);
        printLengthAngWidth(rectangele);
    }

    //扩宽方法
    public static void resize(Rectangele rectangele) {
        //如果宽比长小，进行扩宽
        while (rectangele.getWidth() <= rectangele.getLength()) {
            rectangele.setWidth(rectangele.getWidth() + 1);
        }
    }

    //打印长和宽
    public static void printLengthAngWidth(Quadrilateral quadrilateral) {
        System.out.println(quadrilateral.getLength());
        System.out.println(quadrilateral.getWidth());
    }
}
